import { useContext } from 'react';
import {ThemeContext} from "./MyGlobalContext"

function MyComponent() {
    const theme = useContext(ThemeContext);
    // Context 对象是解决跨层级组件通信的方案。  
  
    return (
      <div style={{ color: theme.color, background: theme.background }}>
        Hello World!
        Hello World!
        Hello World!
      </div>
    );
  }

  export default MyComponent